package com.ody.util.code.model;

import java.util.TreeMap;

import com.google.common.collect.Maps;

public class TypeMapping {
	private final static TreeMap<Integer, String> MAPPING = Maps.newTreeMap();

	static {
		MAPPING.put(4, "Integer");
		MAPPING.put(5, "Integer");
		MAPPING.put(-6, "Integer");
		MAPPING.put(-5, "Long");
		
		MAPPING.put(-5, "Long");

		MAPPING.put(3, "java.math.BigDecimal");
		MAPPING.put(6, "java.math.BigDecimal");
		MAPPING.put(8, "java.math.BigDecimal");

		MAPPING.put(-1, "String");
		MAPPING.put(1, "String");
		MAPPING.put(12, "String");
		
		MAPPING.put(91, "java.util.Date");
		MAPPING.put(92, "java.util.Date");
		MAPPING.put(93, "java.util.Date");
	}
	
	public static String getTypeFullName(int sqlType) {
		String type =  MAPPING.get(sqlType);
		if (type != null) return type;
		
		Integer key = MAPPING.higherKey(sqlType);
		if (key != null) return MAPPING.get(key);
		
		return null;
	}
}
